#!/bin/bash

#优化
AAA=`cat -n  /etc/zabbix/zabbix_agentd.conf   | grep "Timeout="  | awk '{print $1}'`;
A=`cat -n  /etc/zabbix/zabbix_agentd.conf  | grep StartAgents=   | awk '{print $1}'`
B=`cat -n  /etc/zabbix/zabbix_agentd.conf  | grep RefreshActiveChecks=   | awk '{print $1}'`
C=`cat -n  /etc/zabbix/zabbix_agentd.conf  | grep BufferSize=  | awk '{print $1}'`
D=`cat -n  /etc/zabbix/zabbix_agentd.conf  | grep Timeout=  | awk '{print $1}'`

sed -i ''"$AAA"'c  Timeout=15' /etc/zabbix/zabbix_agentd.conf
sed -i  ''"$A"'c StartAgents=1'   /etc/zabbix/zabbix_agentd.conf
sed -i   ''"$B"'c RefreshActiveChecks=1800'  /etc/zabbix/zabbix_agentd.conf
sed -i   ''"$C"'c BufferSize=200'   /etc/zabbix/zabbix_agentd.conf
sed -i   ''"$D"'c Timeout=10'    /etc/zabbix/zabbix_agentd.conf

systemctl restart zabbix-agent
